using System;
namespace MicroMsg.Common.Audio.Amr
{
	public class AMRDecodeFloat
	{
		private object m_decoder;
		public AMRDecodeFloat()
		{
			this.m_decoder = GloabFunc.Decoder_Interface_init();
		}
		~AMRDecodeFloat()
		{
			GloabFunc.Decoder_Interface_exit(this.m_decoder);
		}
		public bool amr2pcm(byte[] byte_0, int amr_len, short[] short_0, ref int pcm_len, int max_pcm_len)
		{
			byte[] array = new byte[32];
			short[] array2 = new short[160];
			pcm_len = 0;
			int i = 0;
			int num = 0;
			while (i < amr_len)
			{
				GloabFunc.memcpy(array, 0, byte_0, i, 1);
				i++;
				int num2 = array[0] >> 3 & 15;
				int num3 = (int)DefineConstants.read_size[num2];
				GloabFunc.memcpy(array, 1, byte_0, i, num3);
				i += num3;
				GloabFunc.Decoder_Interface_Decode(this.m_decoder, array, 0, array2, 0, 0);
				if (num + 160 < max_pcm_len)
				{
					GloabFunc.short_copy(array2, 0, 0, 160, short_0, num);
					num += 160;
					pcm_len += 160;
				}
			}
			return true;
		}
	}
}
